<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Caffe: caffe::DataTransformer&lt; Dtype &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Caffe
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacecaffe.html">caffe</a></li><li class="navelem"><a class="el" href="classcaffe_1_1DataTransformer.html">DataTransformer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classcaffe_1_1DataTransformer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">caffe::DataTransformer&lt; Dtype &gt; Class Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Applies common transformations to the input data, such as scaling, mirroring, substracting the image mean...  
 <a href="classcaffe_1_1DataTransformer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="data__transformer_8hpp_source.html">data_transformer.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae598f617042b2d68f4bab0dd3bd542f0"><td class="memItemLeft" align="right" valign="top"><a id="ae598f617042b2d68f4bab0dd3bd542f0"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>DataTransformer</b> (const TransformationParameter &amp;param, Phase phase)</td></tr>
<tr class="separator:ae598f617042b2d68f4bab0dd3bd542f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d807c7dc250e66b62d97d9847278e68"><td class="memItemLeft" align="right" valign="top"><a id="a6d807c7dc250e66b62d97d9847278e68"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1DataTransformer.html#a6d807c7dc250e66b62d97d9847278e68">InitRand</a> ()</td></tr>
<tr class="memdesc:a6d807c7dc250e66b62d97d9847278e68"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the Random number generations if needed by the transformation. <br /></td></tr>
<tr class="separator:a6d807c7dc250e66b62d97d9847278e68"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1626db49587d506a91e7b70373ace816"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1DataTransformer.html#a1626db49587d506a91e7b70373ace816">Transform</a> (const Datum &amp;datum, <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *transformed_blob)</td></tr>
<tr class="memdesc:a1626db49587d506a91e7b70373ace816"><td class="mdescLeft">&#160;</td><td class="mdescRight">Applies the transformation defined in the data layer's transform_param block to the data.  <a href="#a1626db49587d506a91e7b70373ace816">More...</a><br /></td></tr>
<tr class="separator:a1626db49587d506a91e7b70373ace816"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a082cad626c5f51c9f8d93bb88cca1bd0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1DataTransformer.html#a082cad626c5f51c9f8d93bb88cca1bd0">Transform</a> (const vector&lt; Datum &gt; &amp;datum_vector, <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *transformed_blob)</td></tr>
<tr class="memdesc:a082cad626c5f51c9f8d93bb88cca1bd0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Applies the transformation defined in the data layer's transform_param block to a vector of Datum.  <a href="#a082cad626c5f51c9f8d93bb88cca1bd0">More...</a><br /></td></tr>
<tr class="separator:a082cad626c5f51c9f8d93bb88cca1bd0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a168abf1bf9466420da6968178c6edb4d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1DataTransformer.html#a168abf1bf9466420da6968178c6edb4d">Transform</a> (<a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *input_blob, <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *transformed_blob)</td></tr>
<tr class="memdesc:a168abf1bf9466420da6968178c6edb4d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Applies the same transformation defined in the data layer's transform_param block to all the num images in a input_blob.  <a href="#a168abf1bf9466420da6968178c6edb4d">More...</a><br /></td></tr>
<tr class="separator:a168abf1bf9466420da6968178c6edb4d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1e43b0fb80cded5bb854e1a06004bebf"><td class="memItemLeft" align="right" valign="top">vector&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1DataTransformer.html#a1e43b0fb80cded5bb854e1a06004bebf">InferBlobShape</a> (const Datum &amp;datum)</td></tr>
<tr class="memdesc:a1e43b0fb80cded5bb854e1a06004bebf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Infers the shape of transformed_blob will have when the transformation is applied to the data.  <a href="#a1e43b0fb80cded5bb854e1a06004bebf">More...</a><br /></td></tr>
<tr class="separator:a1e43b0fb80cded5bb854e1a06004bebf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac829dd6448dcce67acb1e22a2554db4b"><td class="memItemLeft" align="right" valign="top">vector&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1DataTransformer.html#ac829dd6448dcce67acb1e22a2554db4b">InferBlobShape</a> (const vector&lt; Datum &gt; &amp;datum_vector)</td></tr>
<tr class="memdesc:ac829dd6448dcce67acb1e22a2554db4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Infers the shape of transformed_blob will have when the transformation is applied to the data. It uses the first element to infer the shape of the blob.  <a href="#ac829dd6448dcce67acb1e22a2554db4b">More...</a><br /></td></tr>
<tr class="separator:ac829dd6448dcce67acb1e22a2554db4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:ac3e52731074a73b05ff0527d2febc8f2"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1DataTransformer.html#ac3e52731074a73b05ff0527d2febc8f2">Rand</a> (int n)</td></tr>
<tr class="memdesc:ac3e52731074a73b05ff0527d2febc8f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Infers the shape of transformed_blob will have when the transformation is applied to the data. It uses the first element to infer the shape of the blob.  <a href="#ac3e52731074a73b05ff0527d2febc8f2">More...</a><br /></td></tr>
<tr class="separator:ac3e52731074a73b05ff0527d2febc8f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96c70b694d85f763934274e2fd92e6eb"><td class="memItemLeft" align="right" valign="top"><a id="a96c70b694d85f763934274e2fd92e6eb"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>Transform</b> (const Datum &amp;datum, Dtype *transformed_data)</td></tr>
<tr class="separator:a96c70b694d85f763934274e2fd92e6eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a7d0dd7f13701a450c37c989a39ac50e0"><td class="memItemLeft" align="right" valign="top"><a id="a7d0dd7f13701a450c37c989a39ac50e0"></a>
TransformationParameter&#160;</td><td class="memItemRight" valign="bottom"><b>param_</b></td></tr>
<tr class="separator:a7d0dd7f13701a450c37c989a39ac50e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28e1ac0553c09e21036f671b73a1e0dd"><td class="memItemLeft" align="right" valign="top"><a id="a28e1ac0553c09e21036f671b73a1e0dd"></a>
shared_ptr&lt; <a class="el" href="classcaffe_1_1Caffe_1_1RNG.html">Caffe::RNG</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>rng_</b></td></tr>
<tr class="separator:a28e1ac0553c09e21036f671b73a1e0dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a30cf039d7452683f4f91e022fd8eec32"><td class="memItemLeft" align="right" valign="top"><a id="a30cf039d7452683f4f91e022fd8eec32"></a>
Phase&#160;</td><td class="memItemRight" valign="bottom"><b>phase_</b></td></tr>
<tr class="separator:a30cf039d7452683f4f91e022fd8eec32"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a74d5da590321195fdaa7d2c9f6b372fd"><td class="memItemLeft" align="right" valign="top"><a id="a74d5da590321195fdaa7d2c9f6b372fd"></a>
<a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>data_mean_</b></td></tr>
<tr class="separator:a74d5da590321195fdaa7d2c9f6b372fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04a2c85e464047c84b98aa677ad19d94"><td class="memItemLeft" align="right" valign="top"><a id="a04a2c85e464047c84b98aa677ad19d94"></a>
vector&lt; Dtype &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>mean_values_</b></td></tr>
<tr class="separator:a04a2c85e464047c84b98aa677ad19d94"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename Dtype&gt;<br />
class caffe::DataTransformer&lt; Dtype &gt;</h3>

<p>Applies common transformations to the input data, such as scaling, mirroring, substracting the image mean... </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a1e43b0fb80cded5bb854e1a06004bebf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1e43b0fb80cded5bb854e1a06004bebf">&#9670;&nbsp;</a></span>InferBlobShape() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">vector&lt; int &gt; <a class="el" href="classcaffe_1_1DataTransformer.html">caffe::DataTransformer</a>&lt; Dtype &gt;::InferBlobShape </td>
          <td>(</td>
          <td class="paramtype">const Datum &amp;&#160;</td>
          <td class="paramname"><em>datum</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Infers the shape of transformed_blob will have when the transformation is applied to the data. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">datum</td><td>Datum containing the data to be transformed. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac829dd6448dcce67acb1e22a2554db4b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac829dd6448dcce67acb1e22a2554db4b">&#9670;&nbsp;</a></span>InferBlobShape() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">vector&lt; int &gt; <a class="el" href="classcaffe_1_1DataTransformer.html">caffe::DataTransformer</a>&lt; Dtype &gt;::InferBlobShape </td>
          <td>(</td>
          <td class="paramtype">const vector&lt; Datum &gt; &amp;&#160;</td>
          <td class="paramname"><em>datum_vector</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Infers the shape of transformed_blob will have when the transformation is applied to the data. It uses the first element to infer the shape of the blob. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">datum_vector</td><td>A vector of Datum containing the data to be transformed. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac3e52731074a73b05ff0527d2febc8f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac3e52731074a73b05ff0527d2febc8f2">&#9670;&nbsp;</a></span>Rand()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classcaffe_1_1DataTransformer.html">caffe::DataTransformer</a>&lt; Dtype &gt;::Rand </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>n</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Infers the shape of transformed_blob will have when the transformation is applied to the data. It uses the first element to infer the shape of the blob. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mat_vector</td><td>A vector of Mat containing the data to be transformed. Generates a random integer from Uniform({0, 1, ..., n-1}).</td></tr>
    <tr><td class="paramname">n</td><td>The upperbound (exclusive) value of the random number. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A uniformly random integer value from ({0, 1, ..., n-1}). </dd></dl>

</div>
</div>
<a id="a1626db49587d506a91e7b70373ace816"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1626db49587d506a91e7b70373ace816">&#9670;&nbsp;</a></span>Transform() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classcaffe_1_1DataTransformer.html">caffe::DataTransformer</a>&lt; Dtype &gt;::Transform </td>
          <td>(</td>
          <td class="paramtype">const Datum &amp;&#160;</td>
          <td class="paramname"><em>datum</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&#160;</td>
          <td class="paramname"><em>transformed_blob</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Applies the transformation defined in the data layer's transform_param block to the data. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">datum</td><td>Datum containing the data to be transformed. </td></tr>
    <tr><td class="paramname">transformed_blob</td><td>This is destination blob. It can be part of top blob's data if set_cpu_data() is used. See data_layer.cpp for an example. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a082cad626c5f51c9f8d93bb88cca1bd0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a082cad626c5f51c9f8d93bb88cca1bd0">&#9670;&nbsp;</a></span>Transform() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classcaffe_1_1DataTransformer.html">caffe::DataTransformer</a>&lt; Dtype &gt;::Transform </td>
          <td>(</td>
          <td class="paramtype">const vector&lt; Datum &gt; &amp;&#160;</td>
          <td class="paramname"><em>datum_vector</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&#160;</td>
          <td class="paramname"><em>transformed_blob</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Applies the transformation defined in the data layer's transform_param block to a vector of Datum. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">datum_vector</td><td>A vector of Datum containing the data to be transformed. </td></tr>
    <tr><td class="paramname">transformed_blob</td><td>This is destination blob. It can be part of top blob's data if set_cpu_data() is used. See memory_layer.cpp for an example. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a168abf1bf9466420da6968178c6edb4d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a168abf1bf9466420da6968178c6edb4d">&#9670;&nbsp;</a></span>Transform() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classcaffe_1_1DataTransformer.html">caffe::DataTransformer</a>&lt; Dtype &gt;::Transform </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&#160;</td>
          <td class="paramname"><em>input_blob</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&#160;</td>
          <td class="paramname"><em>transformed_blob</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Applies the same transformation defined in the data layer's transform_param block to all the num images in a input_blob. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">input_blob</td><td>A <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> containing the data to be transformed. It applies the same transformation to all the num images in the blob. </td></tr>
    <tr><td class="paramname">transformed_blob</td><td>This is destination blob, it will contain as many images as the input blob. It can be part of top blob's data. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>include/caffe/<a class="el" href="data__transformer_8hpp_source.html">data_transformer.hpp</a></li>
<li>src/caffe/data_transformer.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Aug 3 2017 23:11:22 for Caffe by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
